package prototype;

public class PrintThread implements Runnable {

	private Agent agent;

	public PrintThread(Agent a) {
		agent = a;
	}

	@Override
	public void run() {
		while (true) {
			synchronized (agent) {
				if (agent.moving())
					System.out.print(".");
				else {
					System.out.print("|");
				}
				agent.notifyAll();
				try {
					Thread.sleep(1000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}
	}

}
